package com.ethink.platform.controller.warehouse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.ethink.framework.common.web.BaseController;
import com.ethink.framework.common.web.response.CommonResponse;
import com.ethink.warehouse.api.MateInventoryOtherOutLogDetailFacade;
import com.ethink.warehouse.api.info.MateInventoryOtherOutLogDetailInfo;
import com.ethink.warehouse.api.request.MateInventoryOtherOutLogDetailAddRequest;
import com.ethink.warehouse.api.request.MateInventoryOtherOutLogDetailQueryRequest;
import com.ethink.warehouse.api.request.MateInventoryOtherOutLogDetailUpdateRequest;

/**
 * 其他出库明细 Controller
 *
 * @author default
 * @date 2023-02-08
 */
@Tag(name = "MateInventoryOtherOutLogDetailController", description = "其他出库明细 Controller")
@RestController
@Slf4j
@RequestMapping("platform-server/v1/warehouse-service")
public class MateInventoryOtherOutLogDetailController extends BaseController {

    @Autowired
    private MateInventoryOtherOutLogDetailFacade mateInventoryOtherOutLogDetailFacade;

    @Operation(summary = "分页查询")
    @GetMapping("/mateInventoryOtherOutLogDetail/query")
    public CommonResponse<List<MateInventoryOtherOutLogDetailInfo>> queryMateInventoryOtherOutLogDetail(MateInventoryOtherOutLogDetailQueryRequest request) {
        return succeedWithPage(mateInventoryOtherOutLogDetailFacade.queryMateInventoryOtherOutLogDetail(request));
    }

    @Operation(summary = "详情查询")
    @GetMapping("/mateInventoryOtherOutLogDetail/get/{mateInventoryOtherOutLogDetailId}")
    public CommonResponse<MateInventoryOtherOutLogDetailInfo> getMateInventoryOtherOutLogDetailById(@PathVariable("mateInventoryOtherOutLogDetailId") Long mateInventoryOtherOutLogDetailId) {
        return succeedWith(mateInventoryOtherOutLogDetailFacade.getMateInventoryOtherOutLogDetailById(mateInventoryOtherOutLogDetailId));
    }

    @Operation(summary = "查询所有")
    @GetMapping("/mateInventoryOtherOutLogDetail/list")
    public CommonResponse<List<MateInventoryOtherOutLogDetailInfo>> listMateInventoryOtherOutLogDetail(MateInventoryOtherOutLogDetailQueryRequest request) {
        return succeedWith(mateInventoryOtherOutLogDetailFacade.listMateInventoryOtherOutLogDetail(request));
    }

    @Operation(summary = "新增")
    @PostMapping("/mateInventoryOtherOutLogDetail/add")
    public CommonResponse addMateInventoryOtherOutLogDetail(@RequestBody MateInventoryOtherOutLogDetailAddRequest request) {
        mateInventoryOtherOutLogDetailFacade.addMateInventoryOtherOutLogDetail(request);
        return succeed();
    }

    @Operation(summary = "更新")
    @PutMapping("/mateInventoryOtherOutLogDetail/update")
    public CommonResponse updateMateInventoryOtherOutLogDetail(@RequestBody MateInventoryOtherOutLogDetailUpdateRequest request) {
        mateInventoryOtherOutLogDetailFacade.updateMateInventoryOtherOutLogDetail(request);
        return succeed();
    }

    @Operation(summary = "删除")
    @PutMapping("/mateInventoryOtherOutLogDetail/delete/{mateInventoryOtherOutLogDetailId}")
    public CommonResponse deleteMateInventoryOtherOutLogDetail(@PathVariable("mateInventoryOtherOutLogDetailId") Long mateInventoryOtherOutLogDetailId) {
        mateInventoryOtherOutLogDetailFacade.deleteMateInventoryOtherOutLogDetail(mateInventoryOtherOutLogDetailId);
        return succeed();
    }

}